package language.advanced.Concurrent;

import org.junit.Test;

public class d {

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {while (true){A.a="sa"; A.b="sb";}}).start();
        new Thread(() -> {while (true){A.a="da"; A.b="db";}}).start();
        new Thread(() -> {
            while (true){
                System.out.println(A.a + A.b);
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();
        while (true){
            Thread.sleep(10);
        }
    }

    public static String a = "我们的世界真的是美好啊";
    @Test
    public void main2() throws InterruptedException {
        new Thread(() -> {while (true){d.a="我们的世界真的是美好啊";}}).start();
        new Thread(() -> {while (true){d.a="个人能力提升和职业发展收益";}}).start();
        new Thread(() -> {
            while (true){
                System.out.println(d.a.hashCode());
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();
        while (true){
            Thread.sleep(10);
        }
    }

    @Test
    public void Sdf(){
        String a = "我们的世界真的是美好啊";
        String b = "个人能力提升和职业发展收益";
        System.out.println(a.hashCode());
        System.out.println(b.hashCode());
    }

    public static double b = 22222222222f;
    @Test
    public void main3() throws InterruptedException {
        new Thread(() -> {while (true){d.b=22222222222f;}}).start();
        new Thread(() -> {while (true){d.b=33333333333f;}}).start();
        new Thread(() -> {
            while (true){
                System.out.println(d.b);
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();
        while (true){
            Thread.sleep(10);
        }
    }
}

class A{
    public static String a;
    public static String b;

    @Override
    public String toString() {
        return a + b;
    }
}
